package com.mxpio.erp.inventory.service.impl;

import com.mxpio.erp.common.inventory.service.LotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mxpio.erp.common.inventory.entity.WarehouseOrderLine;
import com.mxpio.erp.common.inventory.service.WarehouseOrderLineService;
import com.mxpioframework.system.service.impl.BaseServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;

@Service
public class WarehouseOrderLineServiceImpl extends BaseServiceImpl<WarehouseOrderLine> implements WarehouseOrderLineService {
    @Autowired
    private LotService lotService;
    @Override
    @Transactional(readOnly = true)
    public void handleWarehouseOrderLineQuantity(List<WarehouseOrderLine> warehouseOrderLine) {
        if (warehouseOrderLine!=null&&warehouseOrderLine.size()>0){//查询仓单行 已执行数量
            for (WarehouseOrderLine line:warehouseOrderLine){
                BigDecimal completeQuantity = lotService.getMaxQuantityByWo(line.getBizNo(), line.getLineNo());
                line.setActualQuantity(completeQuantity);
            }
        }
    }
}
